import { mutableHandlers, readonlyHandlers } from './baseHandlers';

export const enum ReactiveFlags {
	IS_REACTIVE = '__v_isReactive',
	IS_READONLY = '__v_isReadonly'
}
export function reactive(raw) {
	return createActivedObject(raw, mutableHandlers);
}

export function readonly(raw) {
	return createActivedObject(raw, readonlyHandlers);
}

function createActivedObject(raw, baseHandlers) {
	return new Proxy(raw, baseHandlers);
}
export function isReactive(value) {
	return !!value[ReactiveFlags.IS_REACTIVE];
}
export function isReadonly(value) {
	return !!value[ReactiveFlags.IS_READONLY];
}
